# coding:utf-8
#请合并这两个字典，并打印出来。(有相同键时，取其值更大的。)
def dict():
    dict1 = {'a': 10, 'b': 8, 'd': 7}
    dict2 = {'d': 6, 'c': 4}
    for i in dict2:
        if i in dict1:
            if int(dict1[i])<int(dict2[i]):  #如果值小于则取大的
                dict1[i]=dict2[i]
        else:
            fict={i:dict2[i]}
            dict1.update(fict)
    print(dict1)

if __name__ == '__main__':
    dict()